<!--
==========================================================================
云捷GO自动生成列表页面代码,只生成一次,按需修改.
生成日期：{{.table.CreateTime}}
生成路径: template/{{.table.ModuleName}}/{{.table.BusinessName}}/list.html
生成人：{{.table.FunctionAuthor}}
==========================================================================
-->
<!DOCTYPE html>
<html lang="zh">
<head>
    {{printf `{{template "header" .Cookie.OssUrl}}`}}
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>{{range $index, $column := .table.Columns}} {{if eq $column.IsQuery "1"}} {{if eq $column.HtmlType "input"}}
                        <li>
                            <p>{{$column.ColumnComment}}：</p>
                            <input type="text" name="{{$column.HtmlField}}"/>
                        </li>
                        {{else if eq $column.HtmlType "select" "radio"}} {{if ne $column.DictType ""}}
                            <li>
                                <p>{{$column.ColumnComment}}：</p> {{printf `{{getDictTypeSelect "%v" "%v" "%v" "" "" "所有" ""}}` $column.DictType $column.HtmlField $column.HtmlField}}
                            </li> {{else}} <li>
                                <p>{{$column.ColumnComment}}：</p>
                                <select name="{{$column.HtmlField}}">
                                    <option value="">所有</option>
                                </select>
                            </li> {{end}}
                        {{else if eq $column.HtmlType "datetime"}}
                        <li class="select-time">
                            <p>{{$column.ColumnComment}}：</p>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="beginTime"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTime"/>
                        </li>  {{end}} {{end}} {{end}}
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            {{printf `{{getPermiButton .Session.uid "%v:%v:add" "新增" "btn btn-success" "fa fa-plus"}}` .table.ModuleName .table.BusinessName}}
            {{printf `{{getPermiButton .Session.uid "%v:%v:edit" "修改" "btn btn-primary single disabled" "fa fa-edit"}}` .table.ModuleName .table.BusinessName}}
            {{printf `{{getPermiButton .Session.uid "%v:%v:remove" "删除" "btn btn-danger multiple disabled" "fa fa-remove"}}` .table.ModuleName .table.BusinessName}}
            {{printf `{{getPermiButton .Session.uid "%v:%v:export" "导出" "btn btn-warning" "fa fa-download"}}` .table.ModuleName .table.BusinessName}}
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
{{printf `{{template "footer" .Cookie.OssUrl}}`}}
{{range $index, $column := .table.Columns}} {{if ne $column.DictType ""}}  var ${column.HtmlField}Datas = {{printf `{{getDictTypeData "%v"}}` $column.DictType}}; {{end}} {{end}}
<script type="text/javascript">
    var editFlag = {{printf `{{hasPermi .Session.uid "%v:%v:edit"}}` .table.ModuleName .table.BusinessName}};
    var removeFlag = {{printf `{{hasPermi .Session.uid "%v:%v:remove"}}` .table.ModuleName .table.BusinessName}};

    {{range $index, $column := .table.Columns}} {{if ne $column.DictType ""}}  var ${column.HtmlField}Datas = {{printf `{{getDictTypeData "%v"}}` $column.DictType}}; {{end}} {{end}}
    var prefix = ctx + "{{.table.ModuleName}}/{{.table.BusinessName}}";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "{{.table.FunctionName}}",
            columns: [
                {
                    checkbox: true
                }, {{range $index, $column := .table.Columns}} {{if eq $column.IsPk "1"}}
                {
                    field: '{{$column.ColumnName}}',
                    title: '{{$column.ColumnComment}}',
                    visible: false
                },  {{else if eq $column.IsList "1"}} {{if ne $column.DictType ""}}
                {
                    field: '{{$column.ColumnName}}',
                    title: '{{$column.ColumnComment}}',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel({{$column.HtmlField}}Datas, value);
                    }
                },  {{else}}
                {
                    field: '{{$column.ColumnName}}',
                    title: '{{$column.ColumnComment}}'
                }, {{end}}  {{end}} {{end}}
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.{{.table.PkColumn.ColumnName}} + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.{{.table.PkColumn.ColumnName}} + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });
</script>
</body>
</html>